package com.java.controller.admin;


import com.java.pojo.entity.Lend;
import com.java.pojo.entity.LendReturn;
import com.java.result.Result;
import com.java.service.LendService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 标的准备表 前端控制器
 * </p>
 *
 * @author Helen
 * @since 2021-07-08
 */

@Api(tags = "标的管理")
@RestController
@RequestMapping("/admin/core/lend")
public class AdminLendController {

    @Resource
    private LendService lendService;


    @ApiOperation("标的列表")
    @GetMapping("/list")
    public Result list() {
        List<Lend> lendList = lendService.selectList();
        return Result.ok(lendList);
    }

    @ApiOperation("获取标的信息")
    @GetMapping("/show/{id}")
    public Result show(@PathVariable Long id) {
        Map<String,Object> map = lendService.getLendDetail(id);
        return Result.ok(map);
    }

    //没凑够借款额也可以放款
    @ApiOperation("放款")
    @GetMapping("/makeLoan/{id}")
    public Result makeLoan(@PathVariable Integer id){
        lendService.makeLoan(id);
        return Result.ok();
    }


}

